package unit8.part3;

import javax.swing.*;
import java.awt.*;

public class Calculator {
    public static void main(String[] args) {
        JFrame jFrame = new JFrame("测试计算器");
        jFrame.setSize(400, 300);

        JTextField jTextField = new JTextField(20);
        jTextField.setFont(new Font("微软雅黑", Font.BOLD, 24));
        jFrame.add(jTextField, BorderLayout.NORTH);

        JPanel panel = new JPanel(new GridLayout(4, 4));
        String[] keys = new String[]{"7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", ".", "=", "+"};
        for (String key : keys) {
            panel.add(new JButton(key));
        }
        jFrame.add(panel, BorderLayout.CENTER);

        jFrame.setVisible(true);
    }
}
